package stats;

import java.util.HashMap;
import java.util.Map;

import com.google.common.collect.ConcurrentHashMultiset;

public class GoogleStatsService implements IStatsService
{
	private ConcurrentHashMultiset<String>	stats	= ConcurrentHashMultiset.create();

	public void notify ( String key )
	{
		stats.add(key);
	}

	public Map<String, Number> getStats ( )
	{
		Map<String, Number> copy = new HashMap<String, Number>();
		for (String key : stats.elementSet())
		{
			int count = stats.count(key);
			copy.put(key, count);
		}
		stats.clear();
		return copy;
	}

	public void stop ( )
	{}
}
